package com.ohs.mapper.before;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ohs.pojo.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface TradeMapper extends BaseMapper<ShopCar> {
    //查找购物车记录
    List<Product_ShopCar> findAllShopCars(Integer userId);

    //批量删除购物车记录
    int deleteBatchShopCar(List<Integer> list);

    //根据pId查找商品数量
    Product findProductByPId(Integer pId);

    //根据批量carId查找proId
    List<ShopCar> findShopCarProIdByCarId(List<Integer> list);

    //根据购物车proId连表查询生成订单信息
    List<Product_ShopCar> findGenerateOrderInfoByProId(List<Integer> list);

    //查找地址信息
    List<Address> findAddressByUserId(Integer userId);

    //根据code查省市区的名字
    District findDistrictByCode(String code);

    //批量插入订单
    int insertBatchOrder(List<Order> list);

    //批量插入订单
    int insertOrder(Order order);

    //支付后修改订单status为已收货
    int updateOrderStatusByUserIdAndProId(@Param("userId")Integer userId, @Param("proId")Integer proId);

    //根据userId、status（已收货）查询订单表
    List<Product_Order_Comment> findReceivedGoods(Integer userId);

    //根据userId、proId更新订单表的spare为1，
    int updateOrderSpareByUserIdAndProId(@Param("userId")Integer userId, @Param("proId")Integer proId);

    //根据userId、proId插入评论
    int insertCommentByUserIdAndProId(@Param("userId")Integer userId, @Param("proId")Integer proId, @Param("comment")String comment);

    //根据userId查询已经评论订单表
    List<Product_Order_Comment> findCommentedGoods(Integer userId);

    //按照commentId查找评论
    Comment findCommentsByCommentId(Integer commentId);

    //修改评论
    int updataComments(@Param("commentId")Integer commentId, @Param("comments") String comments);
}
